<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #canvas {
        border: 1px solid;
      }
    </style>
  </head>

  <body>
    <canvas width="400" height="400" id="canvas"> 请升级你的服务器 </canvas>
    <script>
      var canvas = document.querySelector("#canvas");
      var context = canvas.getContext("2d");

      context.arc(
        200,
        200,
        150,
        (Math.PI / 180) * 0,
        (Math.PI / 180) * 360,
        true
      );
      var Radial = context.createRadialGradient(200, 200, 0, 200, 200, 150);
      Radial.addColorStop(0, "red");
      // Radial.addColorStop(0.7, "yellow");
      Radial.addColorStop(1, "#fff");
      context.fillStyle = Radial;
      context.fill();
      var r = 0;
      setInterval(function () {
        // context.clearRect(0, 0, 400, 400);
        r += 1;
        if (r > 150) {
          r = 0;
        }
        Radial = context.createRadialGradient(200, 200,  0 + r, 200, 200, 150 + r);
        Radial.addColorStop(0, "red");
        // Radial.addColorStop(0.7, "yellow");
        Radial.addColorStop(1, "#fff");
        context.fillStyle = Radial;
        context.fill();
      }, 17);
    </script>
  </body>
</html>
